﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PMS
{
    public partial class ShelfForm : Form
    {
        public ShelfForm()
        {
            InitializeComponent();
        }

        private void ShelfForm_Load(object sender, EventArgs e)
        {
            PMS.BLL.Depot Depotbll = new PMS.BLL.Depot();
            cmb_depot.DataSource = Depotbll.GetAllList();
            cmb_depot.ValueMember = "Id";
            cmb_depot.DisplayMember = "DepotName";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            PMS.Model.Shelf shelf = new PMS.Model.Shelf();
            PMS.BLL.Shelf shelfbll = new PMS.BLL.Shelf();
            shelf.Id = 0;
            shelf.DepotId = cmb_depot.SelectedValue.ToString();
            shelf.ShelfName = txt_name.Text;
            if (shelfbll.Insert(shelf))
            {
                MessageBox.Show("添加成功!");
            }
            else
            {
                MessageBox.Show("添加失败!");
            }
        }
    }
}
